package com.zqh.productskuquery.controller;

import com.zqh.myfmmall.result.Result;
import com.zqh.productskuquery.service.ProductSkuQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-02-18 2:15
 */
@RestController
@RequestMapping("productSku")
public class ProductSkuQueryController{
    @Autowired
    private ProductSkuQueryService productSkuQueryService;

    @PostMapping("getByIds")
    public Result getByIds(@RequestBody List<String> ids){
        return Result.success(productSkuQueryService.listByIds(ids));
    }

   @PostMapping("getStockByIds")
    public Result getStockByIds(@RequestBody List<String> ids){
        return productSkuQueryService.getStockByIds(ids);
   }

   @GetMapping("getByProductId/{productId}")
   public Result getByPorductId(@PathVariable("productId") String productId){
       return productSkuQueryService.getByPorductId(productId);
   }

   @PostMapping("getProductsLowestPrice")
    public Result getProductsLowestPrice(@RequestBody List<String> productIds){
       return productSkuQueryService.getProductsLowestPrice(productIds);
   }
}
